﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using RuoVea.ExUtil.Machine;
using RuoVea.Api.Controllers;

namespace RuoVea.Admin.Service
{
    /// <summary>
    /// 服务器信息服务
    /// </summary>
    [AllowAnonymous]
    public class MachineController : ApiBaseController
    {
        /// <summary>
        /// 
        /// </summary>
        public MachineController()
        {

        }

        /// <summary>
        /// 获取服务器资源信息
        /// </summary>
        /// <returns></returns>
        [HttpGet("use")]
        public async Task<dynamic> GetMachineUseInfo()
        {
            var useInfo =ExMachine .GetMachineUseInfo();
            return await Task.FromResult(useInfo);
        }

        /// <summary>
        /// 获取服务器基本参数
        /// </summary>
        /// <returns></returns>
        [HttpGet("base")]
        public async Task<dynamic> GetMachineBaseInfo()
        {
            return await ExMachine.GetMachineBaseInfo();
        }

        /// <summary>
        /// 动态获取网络信息
        /// </summary>
        /// <returns></returns>
        [HttpGet("network")]
        public async Task<dynamic> GetMachineNetWorkInfo()
        {
            var baseInfo = ExMachine.GetMachineNetWorkInfo();
            return await Task.FromResult(baseInfo);
        }
    }
}
